package com.biu.billiards.controller;


import com.biu.billiards.model.vo.OpenDoor.AddOpenDoorVo;
import com.biu.billiards.model.vo.OpenDoor.GetOpenDoorVo;
import com.biu.billiards.model.vo.OpenDoor.UpdateOpenDoorVO;
import com.biu.billiards.model.vo.withdraw.AddWithdrawVo;
import com.biu.billiards.model.vo.withdraw.GetWithdrawVo;
import com.biu.billiards.model.vo.withdraw.UpdateWithdrawVO;
import com.biu.billiards.response.BaseResponse;
import com.biu.billiards.response.RespGenerator;
import com.biu.billiards.service.IOpenDoorService;
import com.biu.billiards.service.IWithdrawService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xue
 * @since 2023-11-21
 */
@RestController
@RequestMapping()
public class WithdrawController {


    @Resource
    private IWithdrawService withdrawService;





    @ApiOperation(value = "获取提现数据")
    @PostMapping("/getWithdrawPage")
    public BaseResponse<Map<String,Object>> getWithdrawPage(@RequestBody GetWithdrawVo getWithdrawVo) {
        return RespGenerator.returnOK(withdrawService.getWithdrawPage(getWithdrawVo));
    }



    @ApiOperation(value = "修改提现信息")
    @PutMapping("/updateWithdraw")
    public BaseResponse<Boolean> updateWithdraw(@RequestBody UpdateWithdrawVO updateWithdrawVO) {
        return RespGenerator.returnOK(withdrawService.updateWithdraw(updateWithdrawVO));
    }


    @ApiOperation(value = "新增提现信息")
    @PostMapping("/addWithdraw")
    public BaseResponse<Boolean> addWithdraw(@RequestBody AddWithdrawVo addWithdrawVo) {
        return RespGenerator.returnOK(withdrawService.addWithdraw(addWithdrawVo));
    }


    @ApiOperation(value = "删除提现信息")
    @DeleteMapping("/deleteWithdraw")
    public BaseResponse<Boolean> deleteWithdraw(@RequestParam("withdrawId") Integer withdrawId) {
        return RespGenerator.returnOK(withdrawService.deleteWithdraw(withdrawId));
    }







}
